<?php
include "Template.php";

/*
 * 所以contrlBase的基本
 */
class ControlBase{
    private $tpl;
    private $db;

    public function __construct(){
        include('functions.php');
        $this->tpl=new Template(array('phpturn'=>true,'debug'=>true));
    }


    public function index(){
        echo "Welcome to use My MVC!";
    }

    public function __set($key,$name){
        $method='set'.ucfirst($key);
        $this->$method($name);//调用子类的setter()
    }

    public function __get($key){
        $method='get'.ucfirst($key);
        $this->$method($key);//调用子类的getter(),$a->b   $a->getB();外部直接用属性来取代getter()
    }

    public function __call($name,$arguments){
        echo "action is not found!";
    }

    public function assign($key, $value){
        $this->tpl->assign($key, $value);
    }

    public function show($file){
        $this->tpl->show($file);
    }

}
?>